
pkgname=lzo2
pkgver=2.10
pkgrel=1
pkgdesc="Portable lossless data compression library"
arch=('x86_64')
url="http://www.oberhumer.com/opensource/lzo"
license=('GPL')
depends=('glibc')
conflicts=('lzo')
replaces=('lzo')
provides=('lzo')
source=("http://www.oberhumer.com/opensource/lzo/download/lzo-${pkgver}.tar.gz")
options=('!libtool')
md5sums=('39d3f3f9c55c87b1e5d6888e1420f4b5')

build() {
  cd lzo-${pkgver}

  ./configure --prefix=/usr --enable-shared
  make

  # minilzo
  gcc $CFLAGS -fpic -Iinclude/lzo -o minilzo/minilzo.o -c minilzo/minilzo.c
  gcc -g -shared -o libminilzo.so.0 -Wl,-soname,libminilzo.so.0 minilzo/minilzo.o
}

check() {
  cd lzo-${pkgver}
  
  make test 
  make check
}

package() {
  cd lzo-${pkgver}
  make DESTDIR=${pkgdir} install

  # minilzo
  install -m 755 libminilzo.so.0 ${pkgdir}/usr/lib
  install -p -m 644 minilzo/minilzo.h ${pkgdir}/usr/include/lzo
  cd ${pkgdir}/usr/lib
  ln -s libminilzo.so.0 libminilzo.so
}
